<script>
export default putStorage;
import putStorage from "./index";
</script>
<!--src 引用css样式-->
<style src="./index.css" lang="css"></style>
<template>
  <div class="brand-wrapper">
    <!--搜索功能-->
    <div class="search-form">
      <el-form :inline="true" class="demo-form-inline">
        <el-form-item label="采购订单编号" size="mini">
          <el-input placeholder="采购订单编号" v-model="searchParams.purchaseCode"></el-input>
        </el-form-item>

        <el-form-item label="采购类型" size="mini">
          <template>
            <el-select v-model="searchParams.purchaseTypeId" placeholder="请选择">
              <el-option
                  v-for="(key,id) in options.purchaseType"
                  :key="id"
                  :label="key"
                  :value="id">
              </el-option>
            </el-select>
          </template>
        </el-form-item>

        <el-form-item label="供应商名称" size="mini">
          <el-input placeholder="供应商名称" v-model="searchParams.supplierName"></el-input>
        </el-form-item>
        <el-form-item label="供应商编码" size="mini">
          <el-input placeholder="供应商编码" v-model="searchParams.supplierCode"></el-input>
        </el-form-item>
        <el-form-item label="请购人" size="mini">
          <el-input placeholder="请购人" v-model="searchParams.buye"></el-input>
        </el-form-item>

        <el-form-item label="日期选项" size="mini">
          <!--日期组件-->
          <el-date-picker
              v-model="pickerOptions.purchaseOrderTime"
              type="datetimerange"
              :picker-options="pickerOptions"
              value-format="yyyy-MM-dd HH:mm:ss"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              align="right"
              @change="chooseTime">
          </el-date-picker>
        </el-form-item>
      </el-form>
    </div>
    <!--查询按钮-->
    <div class="crud-box">
      <el-button type="success" icon="el-icon-edit" size="mini" @click="searchPage()">查询</el-button>
        <el-button type="danger" icon="el-icon-download" size="mini" @click="createBatchExcel()">生成入库单</el-button>
      <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetForm()">重置</el-button>
    </div>



    <!--table表格-->
    <div class="table-box">

      <el-table
          :data="tableData"
          style="width: 100%"
          @selection-change="selectChange">
        <el-table-column
            type="selection"
            width="55" align="center"
            :selectable="selectTable">
        </el-table-column>
        <el-table-column
            prop="id"
            label="序号"
            width="180" align="center">
        </el-table-column>
        <el-table-column
            prop="purchaseCode"
            label="采购订单编号"
            width="180" align="center">
        </el-table-column>
        <el-table-column
            prop="purchaseType"
            label="采购类型"
            width="180" align="center">
        </el-table-column>
        <el-table-column
            prop="supplierCode"
            label="供应商编码" align="center">
        </el-table-column>
        <el-table-column
            prop="supplierName"
            label="供应商名称" align="center">
        </el-table-column>
        <el-table-column
            prop="purchaseStatus"
            label="采购订单状态" align="center">
          <template  slot-scope="scope">
            <el-tag>
              {{scope.row.purchaseStatus}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column
            prop="purchaseOrderTime"
            label="请购日期" align="center">
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template v-slot="obj">
            <el-button type="primary" size="mini"
                       @click="lookPutStorage(obj.row.goodsId)"
                       style="margin-right: 5px">查看</el-button>
            <el-button type="success" size="mini" style="margin-top:-20px" v-if="obj.row.purchaseStatus=='录入完毕'"  @click="createExcel(obj.row.goodsId)">生成入库单</el-button>
            <el-link type="success" :href="`http://localhost:8088/stockOut/create/${obj.row.goodsId}`">
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!--分页-->
    <div class="page-box">
      <el-pagination
          background
          layout="prev, pager, next"
          :current-page="this.searchParams.currentPage"
          :page-size="this.searchParams.pageSize"
          @current-change="currentPageChange"
          :total="total" align="right">
      </el-pagination>
    </div>
  </div>
</template>
